﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Peak.Resources;

namespace Peak.Web.Controllers.Models
{
  class ChangePasswordModelValidator : AbstractValidator<ChangePasswordModel>
  {
    public ChangePasswordModelValidator()
    {
      RuleFor(f => f.OldPassword).NotNull().NotEmpty();
      RuleFor(f => f.Password).NotNull().NotEmpty();
      RuleFor(f => f.ReEnteredPassword).NotNull().NotEmpty();
      RuleFor(f => f.Password).Equal(f => f.ReEnteredPassword).WithLocalizedMessage(()=>ValidationErrors.PasswordMismatch);
    }
  }
}
